import { MidwayHttpError } from '@midwayjs/core';

export function checkHost(origin: any, env: any) {
  let hostArr = [
    'min',
    'https://www.yanzhengma-cc.cloud',
    'http://217.194.133.218',
  ];

  let isAuther = false;

  hostArr.forEach((v, i) => {
    if (origin == v) {
      isAuther = true;
      return;
    }
  });

  if (!isAuther && env != 'local') {
    throw new MidwayHttpError('请求错误!!', 500);
  }
}
